package com.zh.chat.net;

import java.net.DatagramSocket;
import com.zh.chat.util.ConfigUtil;

/**
 * 客户端DTOBase
 * @author 逍遥の剑仙
 *
 */
public class DTOBase {
	protected String SERVER_IP;//服务器IP
	protected int SERVER_PORT;//服务器接收端口
	protected String CLIENT_IP;//客户端IP
	protected int CLIENT_SEND_PORT;//客户端发送端口
	protected int CLIENT_RECV_PORT;//客户端接收端口
	protected int VOICE_IN_PORT;//语音聊天端口
	protected int TCP_PORT;// 客户端收发图片的端口
	protected DatagramSocket inSocket = null;// 监听端口
	protected DatagramSocket outSocket = null;// 发送端口
	protected int MAX_PACKET_SIZE = 2048;//UDP包大小
	protected int IMGBUFFER_SIZE = 40960;//图片缓冲区大小
	protected String CHARSET;
	protected byte[] inBuf = null;
	protected byte[] outBuf = null;
	protected static String dateFormat = null;
	protected static String timeFormat = null;
	
/**
 * 设置配置文件
 * @param config
 */
	public DTOBase(ConfigUtil config) {
		this.SERVER_IP = config.getString("SERVER_IP");
		this.SERVER_PORT = config.getInt("SERVER_PORT");
		this.MAX_PACKET_SIZE = config.getInt("MAX_PACKET_SIZE");
		this.IMGBUFFER_SIZE = config.getInt("IMGBUFFER_SIZE");
		this.CLIENT_SEND_PORT = config.getInt("CLIENT_SEND_PORT");
		this.CLIENT_RECV_PORT = config.getInt("CLIENT_RECV_PORT");
		this.VOICE_IN_PORT = config.getInt("VOICE_IN_PORT");
		this.TCP_PORT = config.getInt("TCP_PORT");
		DTOBase.dateFormat = config.getString("DATE_FORMAT");
		DTOBase.timeFormat = config.getString("TIME_FORMAT");
		this.CHARSET = config.getString("CHARSET");
	}
}
